﻿<Window
    x:Class="PerformanceDude.MSBuildShellExtension.SettingsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
    xmlns:self="clr-namespace:PerformanceDude.MSBuildShellExtension"
    xmlns:common="clr-namespace:PerformanceDude.MSBuildShellExtension.Common;assembly=Common"
    mc:Ignorable="d" Title="MSBuild Shell Extension Settings"
    WindowStartupLocation="CenterScreen"
    ResizeMode="CanMinimize" WindowStyle="ThreeDBorderWindow" SizeToContent="WidthAndHeight" ShowInTaskbar="True">
    <Window.Resources>
        <Style x:Key="BaseStyle" TargetType="Control">
            <Setter Property="Margin" Value="5,5,5,5"/>
        </Style>
        <Style BasedOn="{StaticResource BaseStyle}" TargetType="Button" />
        <Style BasedOn="{StaticResource BaseStyle}" TargetType="CheckBox" >
            <Setter Property="VerticalAlignment" Value="Center"/>
        </Style>
        <Style BasedOn="{StaticResource BaseStyle}" TargetType="ComboBox" />
        <Style BasedOn="{StaticResource BaseStyle}" TargetType="Label" />
        <self:NegateConverter x:Key="NegateConverter" />
    </Window.Resources>
    <StackPanel>
        <StackPanel Orientation="Horizontal">
            <CheckBox x:Name="cbShowOutputWindow" Content="Show output window" IsChecked="{Binding Path=ShowOutputWindow, Mode=TwoWay}" />
            <CheckBox Content="Only if build fails"
                      IsChecked="{Binding Path=ShowOutputWindowOnlyIfBuildFails, Mode=TwoWay}"
                      IsEnabled="{Binding ElementName=cbShowOutputWindow, Path=IsChecked}" >
            </CheckBox>
        </StackPanel>
        <StackPanel IsEnabled="{Binding ElementName=cbShowOutputWindow, Path=IsChecked}">
            <StackPanel Orientation="Horizontal">
                <Label Content="State:" />
                <ComboBox Width="100" SelectedValue="{Binding Path=WindowState, Mode=TwoWay}" SelectedValuePath="Tag" >
                    <ComboBoxItem Content="Maximized" Tag="Maximized" />
                    <ComboBoxItem Content="Minized" Tag="Minized" />
                    <ComboBoxItem Content="Normal" Tag="Normal" />
                </ComboBox>
                <Label Content="Location:" />
                <ComboBox x:Name="cbStartupLocation" Width="100" SelectedValue="{Binding Path=WindowStartupLocation, Mode=TwoWay}" SelectedValuePath="Tag" >
                    <ComboBoxItem Content="Center Screen" Tag="CenterScreen" />
                    <ComboBoxItem Content="Manual" Tag="Manual" />
                </ComboBox>
                <CheckBox Content="Always on top" IsChecked="{Binding Path=Topmost, Mode=TwoWay}" />
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <StackPanel.Style>
                    <Style TargetType="{x:Type StackPanel}">
                        <Setter Property="IsEnabled" Value="False"></Setter>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding ElementName=cbStartupLocation, Path=SelectedValue}" Value="Manual">
                                <Setter Property="UIElement.IsEnabled" Value="True"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </StackPanel.Style>
                <Label Content="Top:" />
                <xctk:DoubleUpDown Value="{Binding Path=Top, Mode=TwoWay}" />
                <Label Content="Left:" />
                <xctk:DoubleUpDown Value="{Binding Path=Left, Mode=TwoWay}" />
                <Label Content="Width:" />
                <xctk:DoubleUpDown Value="{Binding Path=Width, Mode=TwoWay}" />
                <Label Content="Height:" />
                <xctk:DoubleUpDown Value="{Binding Path=Height, Mode=TwoWay}" />
            </StackPanel>
            <CheckBox Content="Save location on close" IsChecked="{Binding Path=SaveWindowLocation, Mode=TwoWay}" />
            <CheckBox x:Name="cbCloseOnSuccessfulBuild" Content="Close on successful build" IsChecked="{Binding Path=CloseWindowsOnSuccessfulBuild, Mode=TwoWay}" />
            <CheckBox Content="Flash when finished"
                      IsChecked="{Binding Path=FlashWindowWhenFinished, Mode=TwoWay}"
                      IsEnabled="{Binding ElementName=cbCloseOnSuccessfulBuild, Path=IsChecked, Converter={StaticResource NegateConverter}}" />
            <StackPanel Orientation="Horizontal">
                <Label Content="Show" />
                <CheckBox Content="Errors" IsChecked="{Binding Path=ShowErrors, Mode=TwoWay}" />
                <CheckBox Content="Warnings" IsChecked="{Binding Path=ShowWarnings, Mode=TwoWay}" />
                <CheckBox Content="Messages" IsChecked="{Binding Path=ShowMessages, Mode=TwoWay}" />
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <Label Content="Logging Verbosity:" />
                <ComboBox Width="100" SelectedValue="{Binding Path=LoggingVerbosity, Mode=TwoWay}" SelectedValuePath="Tag" >
                    <ComboBoxItem Content="Quiet" Tag="Quiet" />
                    <ComboBoxItem Content="Minimal" Tag="Minimal" />
                    <ComboBoxItem Content="Normal" Tag="Normal" />
                    <ComboBoxItem Content="Detailed" Tag="Detailed" />
                    <ComboBoxItem Content="Diagnostic" Tag="Diagnostic" />
                </ComboBox>
            </StackPanel>
            <StackPanel>
                <CheckBox Content="Build in parallel" IsChecked="{Binding Path=MaxCpuCount, Mode=TwoWay}" />
            </StackPanel>
        </StackPanel>
        <Button x:Name="btnOK" Content="OK" Click="btnOK_Click" />
    </StackPanel>
</Window>